<template>
  <div class="order">
    <div class="search">
      <el-input v-model="input" placeholder="请输入内容"></el-input>
      <el-button plain icon="el-icon-search" class="btn1"></el-button>
    </div>

    <el-table :data="orderList" border style="width: 100%">
      <el-table-column prop="order_id" label="订单id" width="50">
      </el-table-column>
      <el-table-column
        prop="order_number"
        label="订单编号"
        width="250"
      ></el-table-column>
      <el-table-column prop="order_price" label="商品价格"> </el-table-column>
      <el-table-column prop="pay_status" label="是否付款">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.pay_status == 0" type="danger">未付款</el-tag>
          <el-tag v-else-if="scope.row.pay_status == 1" type="success"
            >已付款</el-tag
          >
        </template>
      </el-table-column>
      <el-table-column prop="is_send" label="是否发货"> </el-table-column>
      <el-table-column prop="create_time" label="下单时间" width="200">
        <template slot-scope="scope">
          {{ scope.row.create_time | dateFormat }}
        </template>
      </el-table-column>

     
    
      <el-table-column prop="cz" label="操作" width="200">
        <template slot-scope="scope">
          <el-button
            class="btn3"
            type="primary"
            icon="el-icon-edit"
            @click="showbox(scope.row)"
          ></el-button>

          <el-button
            class="btn3"
            type="success"
            icon="el-icon-location"
            @click="showWL"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      class="fenye"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="orderInfo.pagenum"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="orderInfo.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>

    <!-- 修改地址对话框 -->
    <el-dialog @close="guanbi" title="修改地址" :visible.sync="dialogVisible" width="50%">
      <el-form
        :model="dingdan"
        status-icon
        :rules="rules"
        ref="dingdan"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item prop="address1" label="省市区/县">
          <el-cascader
            v-model="dingdan.address1"
            :options="cityData"
            @change="handleChange"
          ></el-cascader>
        </el-form-item>

        <el-form-item prop="address2" label="详细地址">
          <el-input
            type="text"
            class="ipt"
            v-model="dingdan.address2"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>

    <!-- 展示物流 -->
    <el-dialog  title="物流进度" :visible.sync="wl" width="50%">
        
    </el-dialog>
  </div>
</template>

<script>
import {
  getOrderList,
  GxOrderStatus,
  GetOrderDetail,
  GetwuliuInfo,
} from "../../api";
import cityData from "./addressData.js";
export default {
  name: "OrderList",
  data() {
    return {
    wl:false,
     cityData,
      dingdan: {
        address1: [],
        address2: "",
      },
      dialogVisible: false,
      input: "",
      total: 0,
      orderList: [],
      orderInfo: {
        query: "",
        pagenum: 1,
        pagesize: 5,
      },
      rules: {
        address1: [
          { required: true, message: "请选择省市区/县", trigger: "blur" },
        ],
        address2: [
          { required: true, message: "请输入详细地址", trigger: "blur" },
        ],
      },
    };
  },
  created() {
    this.dedao();
  },
  methods: {
    //获取订单列表
    dedao() {
      getOrderList(this.orderInfo).then((res) => {
        console.log(res)
        this.total = res.data.data.total;
        this.orderList = res.data.data.goods;
      });
    },
    //分页
    handleSizeChange(val) {
      this.orderInfo.pagesize = val;
      this.dedao();
    },
    handleCurrentChange(val) {
      this.orderInfo.pagenum = val;
      this.dedao();
    },

    //展示修改地址对话框
    showbox(row) {
      this.dialogVisible = true;
    },
   
    //jiliankuang
    guanbi(){
        this.$refs.dingdan.resetFields()
    },
    handleChange(){
        
    },

    //展示物流
    showWL(){
      this.wl = true
      GetwuliuInfo('1106975712662').then(res=>{
        console.log(res)
      })
      
    }

  },
};
</script>

<style scoped lang="less">
.el-cascader{
    width: 100%;
}
.fenye {
  margin-top: 10px;
}
.order {
  background-color: #fff;
  padding: 15px;
}
.btn3 {
  width: 64px;
  height: 24px;
  font-size: 12px;
  color: #fff;
  padding: 0;
}
.search {
  width: 30%;
  display: flex;
  height: 32px;
  margin-bottom: 20px;
}
/deep/.el-input__inner {
  height: 32px;
}

.btn1 {
  color: #dcdfe6;
}
.btn1:hover,
.btn1:target,
.btn1:focus {
  border-color: #dcdfe6;
}
</style>